<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>

<html>
<head>
    <title>模板管理</title>
    <meta name="decorator" content="default"/>
    <script src="${ctxStatic}/js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="${ctxStatic}/jquery-jbox/2.3/jquery.jBox-2.3.min.js"></script>
    <link href="${ctxStatic}/jquery-jbox/2.3/Skins/Bootstrap/jbox.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript">
        function page(n, s) {
            $("#pageNo").val(n);
            $("#pageSize").val(s);
            $("#searchForm").attr("action", "${ctx}/message/listModel").submit();
            return false;
        }

        function deleteModel(id) {
            top.$.jBox.confirm("确认要删除该模板吗？", "系统提示", function (v, h, f) {
                if (v == "ok") {
                    location.href = "${ctx}/message/deleteModel?id=" + id;
                }
            }, {buttonsFocus: 1});
        }
    </script>
</head>
<body>
<ul class="nav nav-tabs">
    <li class="active"><a href="${ctx}/message/listModel">模板管理</a></li>
    <li><a href="${ctx}/message/editModel">模板新增/修改</a></li>
</ul>
<form:form id="searchForm" modelAttribute="PfModel" method="post" class="breadcrumb form-search">
    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
    <input name="pac4jCsrfToken" type="hidden" value="<%=request.getAttribute("pac4jCsrfToken")%>"/>
    <div>
        <label>模板名称：</label><form:input path="templateName" htmlEscape="false" maxlength="50" class="input-small"/>
        &nbsp;
        <label>业务类型：</label>
        <form:select path="templatType" class="input-medium">
            <form:option value="" label="请选择"/>
            <form:options items="${fns:getDictList('sys_data_msg_busniess_type')}" itemLabel="label" itemValue="value"
                          htmlEscape="false"/>
        </form:select>
        &nbsp;
        <label>发送方式：</label>
        <form:select path="sendMethod" class="input-medium">
            <form:option value="" label="请选择"/>
            <form:options items="${fns:getDictList('model_send_type')}" itemLabel="label" itemValue="value"
                          htmlEscape="false"/>
        </form:select>
        &nbsp;&nbsp;&nbsp;&nbsp;
        <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" onclick="return page();"/>
    </div>
</form:form>
<tags:message content="${message}"/>
<table id="contentTable" class="table table-striped table-bordered table-condensed">
    <thead>
    <tr>
        <th>模板名称</th>
        <th>业务类型</th>
        <th>发送方式</th>
        <th>状态</th>
        <th>最新更新时间</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${page.list}" var="config">
        <tr>
            <td>${config.templateName}</td>
            <td>${fns:getDictLabel(config.templatType,'sys_data_msg_busniess_type','')}</td>
            <td>${fns:getDictLabel(config.sendMethod,'model_send_type','')}</td>
            <td>${fns:getDictLabel(config.status,'model_state','')}</td>
            <td>${config.updatedDate}</td>
            <td>
                <a href="javascript:void(0)" onclick="deleteModel('${config.id}')">删除</a>
                <a href="${ctx}/message/editModel?id=${config.id}">编辑</a>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>
<div class="pagination">${page}</div>
</body>
</html>